package com.tarena.lbs.basic.web.mapper;

import com.tarena.lbs.pojo.basic.dos.UserGroupDO;
import com.tarena.lbs.pojo.basic.query.UserGroupQuery;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserGroupMapper {
    @Select("select * from lbs_user_group")
    List<UserGroupDO> selectAll(UserGroupQuery query);

    @Insert({
            "INSERT INTO lbs_user_group (group_name, tag_ids, ",
            "user_number, business_id, ",
            "create_at) VALUES (",
            "#{groupName,jdbcType=VARCHAR}, #{tagIds,jdbcType=VARCHAR}, ",
            "#{userNumber,jdbcType=INTEGER}, #{businessId,jdbcType=INTEGER}, ",
            "#{createAt,jdbcType=TIMESTAMP})"
    })
    void insert(UserGroupDO uDO);

    @Select("select tag_ids from lbs_user_group where id=#{id}")
    String getTagIdsById(Integer groupId);
}
